<template>
  <ElTag
    :type="currentValue?.type === undefined ? 'primary' : currentValue.type"
    v-if="currentValue !== undefined"
    >{{ currentValue?.label }}</ElTag
  >
</template>

<script setup lang="ts">

type Props = {
  value: any;
  valueMap: {
    value: any;
    label: string;
    type: "primary" | "success" | "info" | "warning" | "danger";
  }[];
};
const props = defineProps<Props>();

onMounted(()=>{
  console.log("valueMap",props.valueMap)
})
const currentValue = computed(() => {
  return props.valueMap.find((x) => (x.value === props.value || x.value?.toString() === props.value?.toString()));
});
</script>
